package com.ruoyi.system.domain.vo;

import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;
import java.util.List;

public class OutsideDto {

    @Data
    public static class Insert{
        List<OutsideDto.DetailVo> detailVoList;
    }

    @Data
    public static class Insert1{
        List<OutsideDto.Info> firstAidList;
    }


    @ApiModel("急救列表")
    @Data
    public static class Info {
        @ApiModelProperty("急救ID")
        private Long id;
        @ApiModelProperty("患者姓名")
        private String patientName;
        @ApiModelProperty("患者性别")
        private String patientSex;
        @ApiModelProperty("患者年龄")
        private String patientAge;
        @ApiModelProperty("患者身份证")
        private String patientIdCard;

        @ApiModelProperty("门诊号")
        private String mzNumber;
        @ApiModelProperty("医生姓名")
        private String doctorName;
        @ApiModelProperty("发病时间")
        private String fbTime;
        @ApiModelProperty("到院时间")
        private String dyTime;

        @ApiModelProperty("ODT(分秒)")
        private Long odt;
        @ApiModelProperty("DNT(分秒)")
        private Long dnt;
        @ApiModelProperty("DIT(分秒)")
        private Long dit;
        @ApiModelProperty("ONT(分秒)")
        private Long ont;
        @ApiModelProperty("DPT(分秒)")
        private Long dpt;
        @ApiModelProperty("PRT(分秒)")
        private Long prt;
        @ApiModelProperty("创建时间")
        private String createTime;
        @ApiModelProperty("创建人")
        private String createBy;
        @ApiModelProperty("初筛其他详情信息")
        private List<DetailRecord> detailRecordList;
    }

    @ApiModel("初筛详情其他信息")
    @Data
    public static class DetailRecord {
        @ApiModelProperty("类别")
        private Byte category;
        @ApiModelProperty("类别名称")
        private String categoryName;
        @ApiModelProperty("code内容")
        private List<DetailRecordInfo> detailRecordInfoList;
    }
    @ApiModel("初筛详情")
    @Data
    public static class DetailRecordInfo {
        @ApiModelProperty("阶段ID")
        private Long id;
        @ApiModelProperty("CODE")
        private String code;
        @ApiModelProperty("CODE描述")
        private String text;
        @ApiModelProperty("code对应的值")
        private Object value;
        /*  @ApiModelProperty("类型")
          private Byte type;*/
        @ApiModelProperty("字典类型")
        private String dictType;
        @ApiModelProperty("type类型")
        private String type;
        @ApiModelProperty("数值范围")
        private Object range;
        @ApiModelProperty("关联信息")
        private Object showType;

        public void setRange(Object range) {
            this.range = JSONUtil.parse(range);
        }

        public void setShowType(Object showType) {
            this.showType = JSONUtil.parse(showType);
        }

    }
    @Data
    public static class DetailVo{
        private Long id;

        private String city;

        private String county;

        private String cityName;

        private String countyName;
        private Byte hospitalLevel;

        private String hospitalName;

        private String departments;

        private String name;

        private String phone;

        private Byte advancedStrokeCenter;

        private Byte strokeCenter;

        private Byte mapHospital;

        private Integer strokeNumber;

        private Integer aisNumberFour;

        private Integer jmrsNumberFour;

        private Integer rtpaNumber;

        private Integer dntNumber;

        private Integer dntNumberFour;

        private Integer dntNumberSix;

        private Integer sichNumber;

        private Integer jmrsNumberOne;

        private Integer aisNumberSix;

        private Integer shouldDirectly;

        private Integer dptMedianNumber;

        private Integer prtMedianNumber;

        private Integer jmrsNumberTwo;

        private Integer deathNumber;

        private Long userId;

        private Long questionnaireId;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createdAt;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date updatedAt;

        private Byte recStatus;
        @ApiModelProperty("是否脱敏 (0：未脱敏 1脱敏)")
        private Byte isDesensitization;
        private Byte pciStatus;

        private Byte submitStatus;

        private String province;

        private Long positionId;


        private Byte status;

        private Byte dangeStatus;
        private List<Record> recordList;

        public String getPhone(){
            if (StrUtil.isNotBlank(phone)) {
                return PhoneUtil.hideBetween(phone).toString();
            }
            return null;
        }

    }
    @Data
    public static class Record{
        private Long detailId;
        private String code;
        private String answer;

    }
}
